﻿





-- 修改设备同步状态
CREATE procedure [dbo].[SbInfo_Update_AnsycState]
@sjtbzt int,
@sblsh int
as
-- 如果为成功状态，则判断该设备所属监视点下设备是否全同步成功，如果全成功则添加数据为当前数据
if(@sjtbzt=2)
begin
	delete from SbDqyh_Info where sblsh=@sblsh
	insert into SbDqyh_Info
	select JsdRyqx_Info.jsdbh,sfzh,sblsh,kh,ryid,sfhbmd,sfkqfq,yxjcsj
	from JsdRyqx_Info
	inner join Jsdsb_Info on(JsdRyqx_Info.jsdbh=Jsdsb_Info.jsdbh)
	where sblsh=@sblsh
end
update Sb_Info set sjtbzt=@sjtbzt where sblsh=@sblsh